package com.bestcem.xm.om.dao.mapper;

import com.bestcem.xm.om.controller.param.BookingParam;
import com.bestcem.xm.om.entity.UserBooking;
import org.apache.ibatis.annotations.Mapper;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 描述信息
 *
 * @author xuan.yang <xuan.yang@idiaoyan.com>
 * @version v1.0
 * @date 2022/1/14 11:52
 */
@Mapper
public interface UserBookingMapper {
    /**
     * 根据id查询
     *
     * @param id
     * @return com.bestcem.xm.om.entity.UserBooking
     * @author zhangfeng <feng.zhang@idiaoyan.com>
     * @date 2022/3/14 18:35
     */
    UserBooking findById(String id);

    /**
     * 查询所有
     *
     * @return java.util.List<com.bestcem.xm.om.entity.UserBooking>
     * @author zhangfeng <feng.zhang@idiaoyan.com>
     * @date 2022/3/14 18:53
     */
    List<UserBooking> findAll();

    /**
     * 拒绝预约
     *
     * @param id
     * @param content
     * @param updateTime
     * @return java.lang.Long
     * @author zhangfeng <feng.zhang@idiaoyan.com>
     * @date 2022/3/15 11:12
     */
    Long rejectBooking(String id, String content, LocalDateTime updateTime);

    /**
     * 通过联系方式和行业id查询
     *
     * @param industryId
     * @param contact
     * @return boolean
     * @author zhangfeng <feng.zhang@idiaoyan.com>
     * @date 2022/3/15 11:17
     */
    Integer findByContactAndIndustryId(String industryId, String contact);

    /**
     * 插入一条数据
     *
     * @param userBooking
     * @return com.bestcem.xm.om.entity.UserBooking
     * @author zhangfeng <feng.zhang@idiaoyan.com>
     * @date 2022/3/15 11:21
     */
    void insert(UserBooking userBooking);

    /**
     * 通过id和状态列表更新字段
     *
     * @param id
     * @param oldStatuses
     * @param userBooking
     * @return boolean
     * @author zhangfeng <feng.zhang@idiaoyan.com>
     * @date 2022/3/15 11:33
     */
    boolean updateByIdAndStatus(String id, List<Integer> oldStatuses, UserBooking userBooking);

    /**
     * 根据客户id更新数据
     *
     * @param userBooking
     * @return void
     * @author zhangfeng <feng.zhang@idiaoyan.com>
     * @date 2022/3/15 11:53
     */
    Integer updateByCustomerId(UserBooking userBooking);

    /**
     * 查询总数
     *
     * @param param
     * @param industryIds
     * @return java.lang.Long
     * @author zhangfeng <feng.zhang@idiaoyan.com>
     * @date 2022/3/15 13:54
     */
    Long countByCondition(BookingParam param, List<String> industryIds);

    /**
     * 分页查询
     *
     * @param param
     * @param industryIds
     * @return java.util.List<com.bestcem.xm.om.entity.UserBooking>
     * @author zhangfeng <feng.zhang@idiaoyan.com>
     * @date 2022/3/15 14:00
     */
    List<UserBooking> findByCondition(BookingParam param, List<String> industryIds);

    /**
     * updateDistributeById
     * @param bookingId
     * @param distribution
     * @return
     */
    Long updateDistributeById(String bookingId, String distribution);

    /**
     * listWeiling
     * @return
     */
    List<UserBooking> listWeiling();

    /**
     * updateByDistributions
     * @param key
     * @param mail
     * @return
     */
    Integer updateByDistributions(String key, String mail);

    /**
     * listDistribution
     * @return
     */
    List<String> listDistribution();

    /**
     * updateByOrgId
     * @param userBooking
     */
    void updateByOrgId(UserBooking userBooking);

    /**
     * 根据更新时间查询
     *
     * @return java.util.List<com.bestcem.xm.om.entity.UserBooking>
     * @author zhangfeng <feng.zhang@idiaoyan.com>
     * @date 2022/8/16 14:17
     */
    List<UserBooking> listByPushStatus();

    /**
     * 通过机构id查询预约信息
     *
     * @param orgIdList
     * @return java.util.List<com.bestcem.xm.om.entity.UserBooking>
     * @author zhangfeng <feng.zhang@idiaoyan.com>
     * @date 2022/8/16 14:25
     */
    List<UserBooking> listByOrgIds(List<String> orgIdList);

    /**
     * 推送状态更新
     *
     * @param bookIds
     * @return void
     * @author zhangfeng <feng.zhang@idiaoyan.com>
     * @date 2022/10/20 17:00
     */
    void updatePushStatusByIds(List<String> bookIds);
}
